package jpack.sz.parser;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import jpack.sz.SzResponse;

/**
 * @author Denis Migol
 * 
 */
public abstract class SzResponseParser<E extends SzResponseEntity> {

	/**
	 * 
	 * @param response
	 * @return
	 */
	public E parse(final SzResponse response) throws SzResponseParserException {
		return parse(new ByteArrayInputStream(response.getMessage().getBytes()));
	}

	/**
	 * 
	 * @param message
	 * @return
	 */
	public abstract E parse(InputStream in) throws SzResponseParserException;
}
